package cn.tedu.demospider.config;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebDriverConfig {

    private String profile = "profile";

    @Bean
    public WebDriver webDriver(){
        System.setProperty("webdriver.gecko.driver", "webdriver/geckodriver");
        FirefoxOptions options = new FirefoxOptions();
        options.addArguments("-profile "+profile);
        return new FirefoxDriver(options);
    }
}
